#!/usr/bin/env bash

# ----------------------------------------------------------------------
# Filename	:  service
# Version	:  1.0
# Date		:  2022/01/27
# Author	:  Lz
# Email		:  liuzuo@kylinos.com.cn 
# History	:     
# 	           Version 1.0, 2022/01/27
# Function	:  审计服务
# Out		:        
#              0 => TPASS
#              1 => TFAIL
#              other=> TCONF
# ----------------------------------------------------------------------

# 测试主题
Title_Env_LTFLIB="安全加固(审计类) - 审计服务"


## TODO : 个性化,初始化
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestInit_LTFLIB(){
	if [ "Z${AuditdSvc_Audit_SSRFlag}" == "Z" ];then
		OutputRet_LTFLIB "${ERROR}"	
		TestRetParse_LTFLIB "未定义变量 AuditdSvc_Audit_SSRFlag"
	elif [ "Z${AuditdSvc_Audit_SSRFlag}" != "ZTrue" -a "Z${AuditdSvc_Audit_SSRFlag}" != "ZFalse" ];then
		OutputRet_LTFLIB "${ERROR}"	
		TestRetParse_LTFLIB "AuditdSvc_Audit_SSRFlag 无效的参数: ${AuditdSvc_Audit_SSRFlag}"
	fi

        return $TPASS
}


## TODO : 清理函数
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestClean_LTFLIB(){
        return $TPASS
}


## TODO : 测试用例集
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
Testsuite_LTFLIB(){
        testcase_1
        return $TPASS
}


## TODO : 测试用例
testcase_1(){
	local svcname="auditd"

	SvcEnable_LTFLIB "${AuditdSvc_Audit_SSRFlag}" "no" "${svcname}"
	TestRetParse_LTFLIB "$svcname 要求自启动状态为 ${AuditdSvc_Audit_SSRFlag} (True->Enable,False->disabled)"

	SvcActive_LTFLIB "${AuditdSvc_Audit_SSRFlag}" "no" "${svcname}"
	TestRetParse_LTFLIB "$svcname 要求当前状态为 ${AuditdSvc_Audit_SSRFlag} (True->Active,False->inactive)"
}


#----------------------------------------------#

source "${LIB_LTFLIB}"
Main_LTFLIB $@
